package com._119yn.host.gst200.mqtt.impl;

import com._119yn.host.gst200.mqtt.MqttMessageReceiver;
import lombok.extern.slf4j.Slf4j;
import org.springframework.lang.NonNull;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;

@Slf4j
public class MqttControlErrorMessageHandler implements MessageHandler {

    private final MqttMessageReceiver mqttMessageReceiver;

    public MqttControlErrorMessageHandler(MqttMessageReceiver mqttMessageReceiver) {
        this.mqttMessageReceiver = mqttMessageReceiver;
    }

    @Override
    public void handleMessage(@NonNull Message<?> message) throws MessagingException {
        mqttMessageReceiver.onMqttErrorMessage(message);
    }

}
